﻿using UnityEngine;
using System.Collections;

public partial class MainScene : Scene
{
	void OpenPopupQuickPVP()
	{
		if (UserData.Instance.userModel.quickPvpInfo != null && UserData.Instance.userModel.quickPvpInfo.victoryCount >= 3)
		{
			Popup_OneButton po = PopupManager.PushPopup(PopupKind.OneButton) as Popup_OneButton;
			po.SetPopupWithTitleAndBody("알림", "하루에 일일침략은 3회 가능합니다.\n내일 다시 도전 해주세요.");
			return;
		}

		Popup_QuickPVP p = PopupManager.PushPopup(PopupKind.QuickPVP) as Popup_QuickPVP;
		p.SetEventOK(gameObject, "On_Invasion_Confirm");
		p.SetEventNO(gameObject, "On_Invasion_Cancel");
	}

	public void On_Invasion_Confirm()
	{
		// 빠른 PVP 여부 설정
		UserData.Instance.isQuickPVPBattle = true;
		StandbyScene.startMode = BattleStartMode.QuickPvP;
		LoadLevelWithDelayAndCameraAnimator("Lobby_4vs4", "Camera Path_PVP");
	}

	public void On_Invasion_Cancel()
	{
		Debug.Log("On_Cancel");
		UserData.Instance.isQuickPVPBattle = false;
	}

	/*
	IEnumerator Process_Invasion()
	{
		Popup_Blur.ClearAll();

		if (fadeScreen != null)
			fadeScreen.DelayTime = 0.5f;

		if ( GameObject.Find ("Camera Path_PVP") )
		{
			HidePanel();
			GameObject.Find ("Camera Path_PVP").GetComponent<CameraPathBezierAnimator>().Play();
		}

		StandbyScene.startMode = BattleStartMode.QuickPvP;
		SceneController.LoadLevel("Lobby_4vs4");
		yield return null;
	}
	*/
}
